<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
   <meta name="copyright" content="Copyright (c) IBM Corporation and others 2006, 2012. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." />
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
   <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css"/>
   <title>Headless Building with APT in Eclipse</title>
</head>

<body>
<h1>Headless Building with APT in Eclipse</h1>
<h2>Instructions for building workspaces from the command-line directly or with ant</h2>

<p>
The APT plug-in can be used in conjunction with Eclipse to build your preconfigured 
workspace, either directly from the command-line or via ant with its built-in ant task.
</p>

<h3>Building from the command-line</h3>
Given an installation of Eclipse with the APT plug-in installed, you can invoke the command-line builder
with the following command:

<pre class="color1">
eclipsec -nosplash -application org.eclipse.jdt.apt.core.aptBuild -data %WORKSPACE%
</pre>

This invokes Eclipse as a console application in headless mode and builds the workspace as provided on the command-line.
Any configuration for the provided workspace will be observed in the build. 

<h3>Building with Ant</h3>
Again, you will need an installation of Eclipse with the APT plug-in installed. Given this, the "apt"
task can be invoked with the following xml in your build.xml file:

<pre class="color1">
&lt;project name="test_eclipse" default="build" basedir="."&gt;

    &lt;taskdef name="apt" classname="org.eclipse.jdt.apt.core.build.JdtApt"/&gt;
    
    &lt;target name="build"&gt;
        &lt;apt workspace="%WORKSPACE%" eclipseHome="%ECLIPSE_HOME%"/&gt;
    &lt;/target&gt;
    
&lt;/project&gt;
</pre>

</body>
</html>
